<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body>
    <script>
      class HD {
        constructor(...array) {
          this.array = array
        }
        find(value) {
          for (const v of this.array) {
            if (v == value) return v
          }
        }
        findIndex(value) {
          for (const key in this.array) {
            if (value == this.array[key]) return key
          }
          return false
        }
        includes(value) {
          for (const v of this.array) {
            if (v == value) return true
          }
          return false
        }
        map(callback) {
          let array = []
          for (const [key, value] of this.array.entries()) {
            array.push(callback(value, key, this.array))
          }
          return array
        }
        filter() {}
      }

      let a = new HD(1, 2, 3)
      let res = a.map((value, key, array) => {
        return value + 100
      })

      console.log(res)

      //   console.log(a.includes(498))

      //   let arr = ['tom', 'yahoo']
      //   //map forEach filter
      //   arr.map((value, key, arr) => {
      //     console.log(arr)
      //   })
    </script>
  </body>
</html>
